﻿using System;
using Gencode.PrsUtil.Print;
using System.Drawing.Printing;
using System.Windows.Forms;
using System.Collections.Generic;

namespace Personalplaner.Modules.Dienstplan.Print
{
	public class PlanGridPrinterClass : PrinterClass
	{
		public PlanGridPrinterClass(PrintDocument pdocument, DataGridView dgrid)
			: base(pdocument, dgrid)
		{
		}

		public PlanGridPrinterClass(PrintDocument pdocument, List<DataGridView> dgridlist)
			: base(pdocument, dgridlist)
		{
		}

		protected override void PrintHeaders(System.Drawing.Graphics g)
		{
			float size = PrintGrid[GridIndex].Headers[0].Height+(PrintGrid[GridIndex][0,0].Height*PrintGrid[GridIndex].Rows);
			if (size > PrintDoc.DefaultPageSettings.PaperSize.Width - PrintDoc.DefaultPageSettings.Margins.Bottom - PrintDoc.DefaultPageSettings.Margins.Top)
			{
				PrintDoc.DefaultPageSettings.Margins.Top = 40;
			}
			base.PrintHeaders(g);
		}
	}
}
